<!--
@Description:UIP办事处服务工单
@Author:zqy
@Date:2022-05-26 20:55:37
@Last Modified by:zqy
@Last Modified time:2022-06-05 13:55:37
-->
<template>
  <div :class="$style.officeOrder">
    <ContentWrap>
      <FormContainer :column="5">
        <el-form ref="form" :model="formData" :rules="formRules" label-width="90px">
          <el-form-item prop="operationMode" label="接收组织">
            <el-select v-model="formData.operationMode" clearable>
              <el-option
                v-for="(r, i) in operationModeOption"
                :key="i"
                :value="r.value"
                :label="r.label"
              />
            </el-select>
          </el-form-item>
          <el-form-item prop="operationType" label="工单类型">
            <el-select v-model="formData.operationType" clearable>
              <el-option
                v-for="(r, i) in operationTypeOption"
                :key="i"
                :value="r.value"
                :label="r.label"
              />
            </el-select>
          </el-form-item>
          <el-form-item prop="disCode" label="经销商">
            <!-- <SearchSelectPicker
              url="/call-center/openapi/v2/workOrderRecord/uip/office/queryDis"
              method="post"
              placeholder="请选择"
              lable-name="customerName"
              value-name="customerCode"
              :value.sync="formData.disCode"
              :lable.sync="formData.disName"
              :current-id.sync="formData.disId"
              clearable
            ></SearchSelectPicker> -->
            <input-with-dialog
              v-model="disData"
              :props="{label:'customerName',value:'customerCode'}"
              :focus-query="true"
              :config="{
                title:'经销商',
                interfacePath:'/call-center/openapi/v2/workOrderRecord/uip/office/queryDis',
                setting:[{prop:'customerCode',title:'编码',width:120},{prop:'customerName',title:'名称',width:250}],
                paramField:'paramKeyword',
                rowKey:'customerCode',
                apiHeader: {'Permission-PerCode': 'office_work_order','Permission-App': 'call-center'}
              }"
              @change="handleDisChange"
            />
          </el-form-item>
          <el-form-item prop="shopCode" label="门店">
            <SearchSelectPicker
              url="/call-center/api/v1/mscInfo/shop/page"
              placeholder="请选择"
              lable-name="shopName"
              value-name="shopCode"
              custom-name="customerName"
              :remote="false"
              :params="{query:{businessStatus: '1,2,6',status:1,customerName: formData.disName},type:1}"
              :must-pid="true"
              :parent-id="formData.disName"
              :value.sync="formData.shopCode"
              :lable.sync="formData.shopName"
            ></SearchSelectPicker>
          </el-form-item>
          <el-form-item prop="customerApplyStatus" label="商家回复">
            <CustomDictSelect
              placeholder="商家回复"
              dict-type-code="CUSTOMER_APPLY_STATUS"
              bind-name="dictName"
              bind-value="dictCode"
              :echo-value.sync="formData.customerApplyStatus"
              filterable
            ></CustomDictSelect>
          </el-form-item>
          <el-form-item prop="processRate" label="维修进度">
            <CustomDictSelect
              placeholder="请选择"
              dict-type-code="PROCESS_RATE"
              bind-name="dictName"
              bind-value="dictCode"
              collapse-tags
              :echo-value.sync="formData.processRate"
              filterable
              multiple
            ></CustomDictSelect>
          </el-form-item>
          <el-form-item prop="createTime" label="创建时间">
            <el-date-picker
              v-model="formData.createTime"
              type="daterange"
              opt
              operator=">"
              :limite="new Date()"
              clearable
              format="yyyy-MM-dd"
              value-format="yyyy-MM-dd"
            />
          </el-form-item>
          <el-form-item prop="contactName" label="顾客姓名">
            <el-input v-model="formData.contactName" clearable placeholder="请输入顾客姓名" />
          </el-form-item>
          <el-form-item prop="contactPhone" label="联系电话">
            <el-input v-model="formData.contactPhone" clearable placeholder="请输入联系电话" />
          </el-form-item>
          <el-form-item prop="buyChannel" label="购买渠道">
            <CustomDictSelect
              placeholder="请选择"
              dict-type-code="PURCHASE_CHANNEL"
              bind-name="dictName"
              bind-value="dictCode"
              :echo-value.sync="formData.buyChannel"
              filterable
              @on-change="buyChannelHandle"
            ></CustomDictSelect>
          </el-form-item>
          <el-form-item prop="businessType1" label="一级业务类型" hidden>
            <CustomDictSelect
              placeholder="请选择"
              dict-type-code="FIRST_LEVEL_BUSINESS_TYPE"
              bind-name="dictName"
              bind-value="dictCode"
              :echo-value.sync="formData.businessType1"
              filterable
            ></CustomDictSelect>
            <!-- @on-change="initBusinessType2" -->
            <!--  <el-select v-model="formData.businessType1" filterable clearable :loading="false" @change="initBusinessType2">
              <el-option
                v-for="(list, index) of businessType1Option"
                :key="index"
                :value="list.businessType"
                :label="list.businessTypeName"
              />
            </el-select> -->
          </el-form-item>
          <el-form-item prop="businessType2" label="二级业务类型">
            <CustomDictSelect
              placeholder="请选择"
              dict-type-code="SECOND_LEVEL_BUSINESS_TYPE"
              bind-name="dictName"
              bind-value="dictCode"
              :echo-value.sync="formData.businessType2"
              filterable
              multiple
            ></CustomDictSelect>
            <!-- <el-select v-model="formData.businessType2" filterable clearable>
              <el-option
                v-for="(list, index) of businessType2Option"
                :key="index"
                :value="list.businessTypeTwo"
                :label="list.businessTypeTwoName"
              />
            </el-select> -->
          </el-form-item>
          <el-form-item key="repairsReason" prop="repairsReason" label="报修原因">
            <CustomDictSelect
              placeholder="请选择"
              dict-type-code="REPAIR_REASON"
              bind-name="dictName"
              bind-value="dictCode"
              filterable
              :echo-value.sync="formData.repairsReason"
            ></CustomDictSelect>
          </el-form-item>
          <el-form-item prop="workOrderCode" label="工单编号">
            <el-input v-model.trim="formData.workOrderCode" clearable placeholder="工单编号" />
          </el-form-item>

          <el-form-item prop="urgencyDegree" label="紧急程度">
            <CustomDictSelect
              placeholder="请选择"
              dict-type-code="URGENCY_DEGREE"
              bind-name="dictName"
              bind-value="dictCode"
              collapse-tags
              :echo-value.sync="formData.urgencyDegree"
              filterable
            ></CustomDictSelect>
          </el-form-item>
          <el-form-item prop="processingDeadline" label="处理截止时间">
            <el-date-picker
              v-model="formData.processingDeadline"
              type="daterange"
              clearable
              opt
              format="yyyy-MM-dd"
              value-format="yyyy-MM-dd"
            />
          </el-form-item>
          <el-form-item prop="operationTime" label="派单时间">
            <el-date-picker
              v-model="formData.operationTime"
              type="daterange"
              clearable
              opt
              format="yyyy-MM-dd"
              value-format="yyyy-MM-dd"
            />
          </el-form-item>
          <el-form-item prop="isTimeoutOrder" label="超时工单">
            <el-select v-model="formData.isTimeoutOrder" filterable clearable placeholder="请选择">
              <el-option
                v-for="(r,i) in yesOrNoOption"
                :key="i"
                :value="r.value"
                :label="r.label"
              ></el-option>
            </el-select>
          </el-form-item>
          <el-form-item prop="isTimeout" label="是否超时">
            <el-select v-model="formData.isTimeout" clearable>
              <el-option
                v-for="(r, i) in yesOrNoOption"
                :key="i"
                :value="r.value"
                :label="r.label"
              />
            </el-select>
          </el-form-item>
          <el-form-item prop="isOverdue" label="是否超期">
            <el-select v-model="formData.isOverdue" clearable>
              <el-option
                v-for="(r,i) in yesOrNoOption"
                :key="i"
                :value="r.value"
                :label="r.label"
              />
            </el-select>
          </el-form-item>
          <el-form-item prop="workOrderState" label="工单状态">
            <CustomDictSelect
              placeholder="请选择"
              dict-type-code="WORK_ORDER_STATUS"
              bind-name="dictName"
              bind-value="dictCode"
              filterable
              :echo-value.sync="formData.workOrderState"
            ></CustomDictSelect>
          </el-form-item>
          <el-form-item prop="timeoutReason" label="处理时效">
            <CustomDictSelect
              dict-type-code="TIMEOUT_REASON"
              bind-name="dictName"
              bind-value="dictCode"
              :echo-value.sync="formData.timeoutReason"
              filterable
            ></CustomDictSelect>
          </el-form-item>
          <el-form-item prop="state" label="接收状态">
            <el-select v-model="formData.state" clearable>
              <el-option
                v-for="(r, i) in receiveStateOption"
                :key="i"
                :value="r.value"
                :label="r.label"
              />
            </el-select>
          </el-form-item>
          <el-form-item align="right" label-width="0px" show more style="white-space: nowrap;">
            <Button @click="resetForm">重置</Button>
            <ExportPane :data-source="selectedArry" :table-config="exportConfig" :other-raw="otherRaws" :fields="exportFields" :query-data-fun="queryHandle" filename="办事处服务工单">导出</ExportPane>
            <Button type="primary" enter @click="queryHandle">查询</Button>
          </el-form-item>
        </el-form>
      </FormContainer>
      <div style="text-align:right">
        <Button type="primary" @click="$refs.table.showSetting = true">设置表格样式</Button>
      </div>
      <table-box
        ref="table"
        no-request
        :other-filters="otherFilters"
        :other-raw="otherRaws"
        :table-config="tableConfig"
        show-index
      />
    </ContentWrap>
  </div>
</template>
<script>
import ContentWrap from '@/components/ContentWrap'
import Button from '@/components/Button'
import FormContainer from '@/components/FormContainer'
import CustomDictSelect from '@/components/CustomDictSelect'
import SearchSelectPicker from '@/components/SearchSelectPicker'
import ExportPane from '@/components/ExportPane'
import { searchBusinessByChannel, searchBusinessTwoByChannel } from '@/api/ChannelBusinessRel'
import { openPage } from '@/utils/outerUtils'

import { filtersRaw } from '@/utils'
import { ccDict } from '@/api/dataDict'
import { postAccept } from '@/api/workOrder'
import { mapGetters } from 'vuex'
export default {
  name: 'OfficeOrder',
  components: {
    ContentWrap,
    Button,
    FormContainer,
    CustomDictSelect,
    SearchSelectPicker,
    ExportPane
  },
  props: {
    query: {
      type: [Boolean],
      default: false
    }
  },
  data() {
    return {
      disData: [], // 当前所选经销商
      businessType1Option: [], // 业务类型1下拉数据
      businessType2Option: [], // 业务类型2下拉数据
      operationModeOption: [
        { value: '01', label: '办事处' },
        { value: '02', label: '经销商' }
      ],
      yesOrNoOption: [
        { value: 1, label: '是' },
        { value: 0, label: '否' }
      ],
      receiveStateOption: [
        { value: '02', label: '已接收' },
        { value: '01', label: '未接收' }
      ],
      operationTypeOption: [
        { value: '01', label: '派工单' },
        { value: '02', label: '抄送工单' }
      ],
      formData: {
        operationMode: '', // 接收组织
        operationType: '', // 工单类型
        disId: '',
        disCode: '', // 经销商
        disName: '',
        shopCode: '', // 门店
        shopName: '',
        customerApplyStatus: '', // 商家回复
        processRate: [], // 维修进度
        createTime: [], // 创建时间
        contactName: '', // 顾客姓名
        contactPhone: '', // 联系电话
        buyChannel: '', // 购买渠道
        businessType1: '', // 业务类型1
        businessType2: [], // 业务类型2
        repairsReason: '', // 报修原因
        workOrderCode: '', // 工单编号
        urgencyDegree: '', // 紧急程度
        processingDeadline: [], // 处理截止时间
        operationTime: [],
        isTimeoutOrder: '', // 超时工单
        isTimeout: '', // 是否超时
        isOverdue: '', // 是否超期
        workOrderState: '', // 工单状态
        timeoutReason: '', // 处理时效
        state: '' // 接收状态
      },
      formRules: {},
      otherFilters: [],
      otherRaws: {},
      tableConfig: {
        interfacePath: '/call-center/openapi/v2/workOrderRecord/uip/office/page',
        // pageFlag: true,
        pageSize: 20,
        hideFuncBar: false,
        // sort: 'createTime',
        // 表格字段动态配置
        setting: [
          {
            prop: 'workOrderCode',
            label: '工单编号',
            width: 170,
            render: (_, row) => {
              const { urgencyDegree, isTimeout, workOrderState } = row
              const shouldRedColor = ([2, 3, '2', '3'].includes(urgencyDegree) || [1, '1'].includes(isTimeout)) && [2, '2'].includes(workOrderState)
              /** || [1, '1'].includes(isOverdue)**/
              // 超时标注为红色
              if (shouldRedColor) {
                return <span style='color:red'>{row.workOrderCode}</span>
              } else {
                return <span>{row.workOrderCode}</span>
              }
            }
          },
          {
            prop: 'businessType1Name',
            label: '一级业务类型',
            width: 140
          },
          {
            prop: 'businessType2Name',
            label: '二级业务类型',
            width: 140
          },
          {
            prop: 'repairsReason',
            label: '报修原因',
            width: 100,
            type: 'select',
            propEnum: {
              appCode: 'call-center',
              domainCode: 'marketing',
              dictTypeCode: 'REPAIR_REASON'
            }
          },
          {
            prop: 'officeName',
            label: '办事处名称',
            width: 140
          },
          {
            prop: 'disName',
            label: '经销商名称',
            width: 140
          },
          {
            prop: 'customerApplyStatus',
            label: '商家回复',
            width: 100,
            type: 'select',
            propEnum: {
              appCode: 'call-center',
              domainCode: 'marketing',
              dictTypeCode: 'CUSTOMER_APPLY_STATUS'
            }
          },
          {
            prop: 'operationType',
            label: '工单类型',
            width: 100,
            formatData: ({ operationType }) => {
              return operationType === '02' ? '抄送工单' : operationType === '01' ? '派工单' : '--'
            }
          },
          {
            prop: 'operationTime',
            label: '派单/抄送时间',
            width: 140
          },
          {
            prop: 'state',
            label: '接收状态',
            width: 140,
            formatData: ({ state }) => {
              return state === '02' ? '已接收' : state === '01' ? '未接收' : '--'
            }
          },
          {
            prop: 'contactName',
            width: 120,
            label: '顾客姓名'
          },
          {
            prop: 'contactPhone',
            width: 120,
            label: '联系电话'
          },
          {
            prop: 'workOrderState',
            width: 120,
            label: '工单状态',
            propEnum: {
              domainCode: 'marketing',
              appCode: 'call-center',
              dictTypeCode: 'WORK_ORDER_STATUS'
            }
          },
          {
            prop: 'urgencyDegree',
            width: 120,
            label: '紧急程度',
            propEnum: {
              domainCode: 'marketing',
              appCode: 'call-center',
              dictTypeCode: 'URGENCY_DEGREE'
            }
          },
          {
            prop: 'processRate',
            width: 120,
            label: '维修进度',
            propEnum: {
              domainCode: 'marketing',
              appCode: 'call-center',
              dictTypeCode: 'PROCESS_RATE'
            }
          },
          {
            prop: 'processingDeadline',
            width: 140,
            label: '处理截止时间'
          },
          {
            prop: 'finishTime',
            width: 140,
            label: '处理完成时间'
          },
          {
            prop: 'isTimeoutOrder',
            width: 140,
            label: '是否超时工单',
            align: 'center',
            formatData: ({ isTimeoutOrder }) => {
              return isTimeoutOrder ? '是' : '否'
            }
          },
          {
            prop: 'isTimeout',
            width: 140,
            label: '是否超时',
            align: 'center',
            formatData: ({ isTimeout }) => {
              return isTimeout ? '是' : '否'
            }
          },
          {
            prop: 'timeoutReason',
            width: 120,
            label: '处理时效',
            propEnum: {
              domainCode: 'marketing',
              appCode: 'call-center',
              dictTypeCode: 'TIMEOUT_REASON'
            }
          },
          {
            prop: 'isOverdue',
            width: 140,
            label: '是否超期',
            align: 'center',
            formatData: ({ isOverdue }) => {
              return isOverdue ? '是' : '否'
            }
          },
          {
            label: '操作',
            fixed: 'right',
            align: 'center',
            render: (_, row) => {
              // 派单/抄送接收状态为已接收的工单操作栏内为编辑按钮
              // 1.工单处理状态已完结的工单操作栏内为查看按钮；
              // 2.查看按钮打开的工单详情页只有工单内容信息，流水记录，附件操作。无留言栏和功能按钮。
              if (row.workOrderState === 3) {
                // 已完结工单只能查看
                return <Button type='primary' onClick={this.previewHandle.bind(this, row)}>查看</Button>
              } else {
                if (row.state !== '02') {
                  // 接收状态
                  return <Button type='primary' onClick={ this.receiveHandle.bind(this, row)}>接收</Button>
                } else {
                  // 已接收
                  return <Button type='primary' onClick={this.editHandle.bind(this, row)}>编辑</Button>
                }
              }
              /* if (row.workOrderState === 1) {
                return <Button type='primary' onClick={ this.receiveHandle.bind(this, row)}>接收</Button>
              } else if (row.workOrderState === 3) {
                return <Button type='primary' onClick={this.previewHandle.bind(this, row)}>查看</Button>
              } else if (row.workOrderState === 2) {
                return <Button type='primary' onClick={this.editHandle.bind(this, row)}>编辑</Button>
              } */
            }
          }
        ]
      },
      selectedArry: [],
      exportFields: {
        workOrderCode: '工单编号',
        workOrderState: {
          label: '工单状态',
          propEnum: {
            dictTypeCode: 'WORK_ORDER_STATUS'
          }
        },
        createBy: '创建人',
        createTime: '创建时间',
        processingDeadline: '处理截止时间',
        isTimeout: {
          label: '是否超时',
          formatData: ({ isTimeout }) => {
            return isTimeout ? '是' : '否'
          }
        },
        isTimeoutTime: '超时时间',
        unseasonalTime: '处理不及时时间',
        isTimeoutOrder: {
          label: '超时工单',
          formatData: v => {
            let t = ''
            for (const item of this.yesOrNoOption) {
              if (Number(item.value) === v.isTimeoutOrder) {
                t = item.label
                break
              }
            }
            return t
          }
        },
        overtimeReason: {
          label: '超时原因',
          propEnum: {
            dictTypeCode: 'OVER_TIME_REASON'
          }
        },
        isOverdue: {
          label: '是否超期',
          formatData: v => {
            let t = ''
            for (const item of this.yesOrNoOption) {
              if (item.value === v.isOverdue) {
                t = item.label
                break
              }
            }
            return t
          }
        },
        overdueReason: {
          label: '超期原因',
          propEnum: {
            dictTypeCode: 'OVERDUE_REASON'
          }
        },
        timeoutReason: {
          label: '处理时效',
          propEnum: {
            dictTypeCode: 'TIMEOUT_REASON'
          }
        },
        onlineShopName: '电商店铺',
        officeName: '办事处',
        disName: '经销商',
        customerApplyStatus: {
          label: '商家回复',
          propEnum: {
            dictTypeCode: 'CUSTOMER_APPLY_STATUS'
          }
        },
        orderCode: '平台单号',
        ecOrderNumber: '电商订单编号',
        nickname: '顾客ID',
        contactName: '联系人',
        contactPhone: '联系电话',
        detailAddress: '详细地址',
        deliveryTime: '送货时间',
        deliveryMethod: {
          label: '配送方式',
          propEnum: {
            dictTypeCode: 'CC_DELIVERY_TYPE'
          }
        },
        deliveryNeed: {
          label: '送装需求',
          propEnum: {
            dictTypeCode: 'DELIVERY_INSTALL_DEMAND'
          }
        },
        businessType1Name: '一级业务类型',
        businessType2Name: '二级业务类型', repairsReason: {
          label: '报修原因',
          propEnum: {
            dictTypeCode: 'REPAIR_REASON'
          }
        },
        callContent: '来电明细',
        customerServiceOpinion: '客服意见'
      },
      detail: {},
      deptName: ''
    }
  },
  computed: {
    ...mapGetters(['userCache', 'deptList', 'user', 'accountNo']),
    exportConfig() {
      const t = { ...this.tableConfig }
      t.setting = []
      return t
    }
  },
  created() {

  },
  activated() {
    this.$nextTick(() => {
      this.$refs.table && this.$refs.table.initTableData('onPage')
    })
  },
  methods: {
    /**
     * 切换购买渠道 ,初始化业务类型1
     * @param {Object} data  购买渠道
     */
    buyChannelHandle(data) {
      const channelCode = data ? Number(data.dictCode || 0) : ''
      // 根据购买渠道获取初始化业务类型
      this.formData.businessType1 = ''
      this.formData.businessType1Name = ''
      this.businessType1Option = []

      this.formData.businessType2 = []
      this.formData.businessType2Name = ''
      this.businessType2Option = []

      this.formData.bpmDeptCode = ''
      this.formData.bpmDeptName = ''
      if (!channelCode) return
      // 根据购买渠道查询一级业务类型
      searchBusinessByChannel(channelCode).then(res => {
        if (res.success === 1) {
          this.businessType1Option = res.data || []
        }
      })
    },
    initBusinessType2() {
      // 根据购买渠道和一级业务类型查询二级业务类型
      this.formData.businessType2 = []
      this.formData.businessType2Name = ''
      this.businessType2Option = []

      this.formData.bpmDeptCode = ''
      this.formData.bpmDeptName = ''
      const parmas = {
        channelCode: this.formData.buyChannel,
        businessType: this.formData.businessType1
      }
      searchBusinessTwoByChannel(parmas).then(res => {
        if (res.success === 1) {
          this.businessType2Option = res.data
        }
      })
    },
    queryHandle(type) {
      const d = this.formData
      // const eq = ['workOrderCode', 'contactPhone', 'workOrderState', 'buyChannel', 'businessType1', 'businessType2', 'urgencyDegree', 'isTimeout']
      // const like = ['contactName']
      const multiple = ['processRate']
      const t = []
      const paramRaws = {}
      // t.push(filtersRaw('qupReceiver', this.accountNo, '='))
      for (const k of Object.keys(d)) {
        let value = d[k]
        if (multiple.includes(k)) {
          value = value || []
          value.length > 0 && t.push(filtersRaw(k, `[${value.join(',')}]`, 'in'))
          continue
        }
        if (k === 'operationTime' && value && value.length === 2) {
          t.push(filtersRaw(k, value[0], '>='))
          t.push(filtersRaw(k, value[1], '<='))
          continue
        }
        if (!d[k] || ((k === 'createTime' || k === 'processingDeadline') && d[k].length <= 1)) continue
        /*
        if (eq.includes(k)) {
          t.push(filtersRaw(k, d[k], '='))
        }
        if (like.includes(k)) {
          t.push(filtersRaw(k, d[k], 'like'))
        }
        if (k === 'createTime' && d[k] && d[k].length > 1) {
          const v = d[k]
          t.push(filtersRaw(k, v[0], '>'), filtersRaw(k, date24(v[1]), '<='))
        }
        if (k === 'processingDeadline' && d[k] && d[k].length > 1) {
          const v = d[k]
          t.push(filtersRaw(k, v[0], '>'), filtersRaw(k, date24(v[1]), '<='))
        } */
        if (k === 'createTime') {
          const v = d[k]
          paramRaws.createBeginTime = `${v[0]} 00:00:00`
          paramRaws.createEndTime = `${v[1]} 23:59:59`
        } else if (k === 'processingDeadline') {
          const v = d[k]
          paramRaws.beginProcessingDeadline = `${v[0]} 00:00:00`
          paramRaws.endProcessingDeadline = `${v[1]} 23:59:59`
        } else {
          paramRaws[k] = d[k]
        }
      }
      this.otherFilters = t
      this.otherRaws = paramRaws
      if (this.otherFilters.length <= 0 && Object.keys(this.otherRaws).length <= 0) {
        this.$message.warning('请选择查询条件!')
        return
      }
      if (type !== 'export') {
        this.$nextTick(() => {
          this.$refs.table.initTableData()
        })
      }
      return this.otherFilters
    },
    resetForm() {
      this.$refs.form.resetFields()
    },
    // 操作
    receiveHandle(row) {
      if (!this.userCache.remoteOrganizations[0]) {
        this.$message.error('该账号没有组织信息！')
        return
      }
      // this.$msgbox({
      //   title: '接收',
      //   message: '确认接收？',
      //   showCancelButton: true,
      //   type: 'warning'
      // }).then(() => {
      const data = {
        deptName: this.userCache.remoteOrganizations[0].orgName,
        handler: this.user.account,
        handlerName: this.user.userName,
        id: row.receiveId
      }
      postAccept(data).then(res => {
        this.$message.success('接收成功！')
        this.$nextTick(() => {
          this.$refs.table.initTableData('onPage')
        })
        // this.$router.push({ name: 'officeOrderDetails', query: { id: row.id }})
        this.editHandle(row)
      })
      // })
    },
    previewHandle(row) {
      // this.$router.push({ name: 'officeOrderDetails', query: { id: row.receiveId, type: 'preview' }})

      const menuCode = process.env.VUE_APP_RESP_MENUCODE
      openPage('/officeOrder/details', { id: row.receiveId, type: 'preview' }, '办事处服务工单查看', menuCode)
    },
    editHandle(row) {
      // this.$router.push({ name: 'officeOrderDetails', query: { id: row.receiveId}})
      const menuCode = process.env.VUE_APP_OFFICE_MENUCODE
      openPage('/officeOrder/details', { id: row.receiveId }, '办事处服务工单编辑', menuCode)
    },
    // 获取字典
    getDictData() {
      ccDict('WORK_ORDER_STATUS').then(res => {
        this.orderStateList = (res.data || []).filter(e => {
          return e.dictName !== '保存'
        })
      })
      ccDict('URGENCY_DEGREE').then(res => {
        this.urgencyList = res.data
      })
    },
    handleDisChange(data) {
      const tmpObj = (data && data[0]) || ''
      const code = (tmpObj && tmpObj.customerCode) || ''
      this.$set(this.formData, 'disCode', code)
      this.$set(this.formData, 'disName', (tmpObj && tmpObj.customerName) || '')
    }
  }
}
</script>
<style lang="scss" module>
.officeOrder {
}
</style>
